
export class BitSet {
    private _val: number = 0
    constructor() {
        this.clear()
    }

    hasState(state: number): boolean {
        state = 1 << state
        return (this._val & state) != 0
    }

    addState(state: number) {
        state = 1 << state
        this._val = this._val | state
    }

    deleteState(state: number) {
        state = 1 << state
        this._val = this._val & ~state
    }

    equal(other: BitSet): boolean {
        return other._val == this._val
    }

    clear() {
        this._val = 0
    }
}